import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";

var _dec, _class;

import React, { PureComponent } from 'react';
import { Button, Form, Input, Row, Col } from 'antd';
import intl from 'utils/intl';
import { SEARCH_FORM_ITEM_LAYOUT } from 'utils/constants';
var FormItem = Form.Item;
var modelPrompt = 'ciam.menuConfig.model.menuConfig';
var commonPrompt = 'cpaas.common';
var QueryForm = (_dec = Form.create({
  fieldNameProp: null
}), _dec(_class = /*#__PURE__*/function (_PureComponent) {
  _inherits(QueryForm, _PureComponent);

  var _super = _createSuper(QueryForm);

  function QueryForm() {
    _classCallCheck(this, QueryForm);

    return _super.apply(this, arguments);
  }

  _createClass(QueryForm, [{
    key: "onClick",
    value: function onClick() {
      var _this$props = this.props,
          _this$props$handleQue = _this$props.handleQueryList,
          handleQueryList = _this$props$handleQue === void 0 ? function (e) {
        return e;
      } : _this$props$handleQue,
          _this$props$form$getF = _this$props.form.getFieldsValue,
          getFieldsValue = _this$props$form$getF === void 0 ? function (e) {
        return e;
      } : _this$props$form$getF;
      var data = getFieldsValue() || {};
      handleQueryList(_objectSpread({}, data));
    }
  }, {
    key: "onReset",
    value: function onReset() {
      var _this$props$form$rese = this.props.form.resetFields,
          resetFields = _this$props$form$rese === void 0 ? function (e) {
        return e;
      } : _this$props$form$rese;
      resetFields();
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props$form$getF2 = this.props.form.getFieldDecorator,
          getFieldDecorator = _this$props$form$getF2 === void 0 ? function (e) {
        return e;
      } : _this$props$form$getF2;
      return /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Row, {
        type: "flex",
        gutter: 24,
        align: "bottom"
      }, /*#__PURE__*/React.createElement(Col, {
        span: 8
      }, /*#__PURE__*/React.createElement(FormItem, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get("".concat(modelPrompt, ".permissionCode")).d('权限编码')
      }), getFieldDecorator('code')( /*#__PURE__*/React.createElement(Input, {
        trim: true,
        typeCase: "lower",
        inputChinese: false
      })))), /*#__PURE__*/React.createElement(Col, {
        span: 8
      }, /*#__PURE__*/React.createElement(FormItem, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get("".concat(modelPrompt, ".permissionName")).d('权限名称')
      }), getFieldDecorator('name')( /*#__PURE__*/React.createElement(Input, null)))), /*#__PURE__*/React.createElement(Col, {
        span: 8
      }, /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(Button, {
        onClick: this.onReset.bind(this),
        style: {
          marginRight: 8
        }
      }, intl.get("".concat(commonPrompt, ".button.reset")).d('重置')), /*#__PURE__*/React.createElement(Button, {
        type: "primary",
        htmlType: "submit",
        onClick: this.onClick.bind(this)
      }, intl.get("".concat(commonPrompt, ".button.search")).d('查询'))))));
    }
  }]);

  return QueryForm;
}(PureComponent)) || _class);
export { QueryForm as default };